package nl.vu.few.ibivu.biomodels.client.ui.cytoscapeweb;


import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

public class CytoscapeWebNetworkModel extends JavaScriptObject {

	protected CytoscapeWebNetworkModel() {}
	
	public static CytoscapeWebNetworkModel create(JsArray<CytoscapeWebNetworkModelNode> nodes, JsArray<CytoscapeWebNetworkModelEdge> edges,
			JsArray<CytoscapeWebDataField> nodeFields, JsArray<CytoscapeWebDataField> edgeFields) {
		CytoscapeWebNetworkModel instance = (CytoscapeWebNetworkModel) JavaScriptObject.createObject();
		instance.setNodes(nodes);
		instance.setEdges(edges);
		instance.setNodesDataSchema(nodeFields);
		instance.setEdgesDataSchema(edgeFields);
		return instance;
	}

	public final native JsArray<CytoscapeWebNetworkModelNode> getNodes() /*-{
		return this.data.nodes;
	}-*/;

	public final native JsArray<CytoscapeWebNetworkModelEdge> getEdges() /*-{
		return this.data.edges;
	}-*/;

	public final native JsArray<CytoscapeWebDataField> getNodesDataSchema() /*-{
		return this.dataSchema.nodes;
	}-*/;

	public final native JsArray<CytoscapeWebDataField> getEdgesDataSchema() /*-{
		return this.dataSchema.edges;
	}-*/;

	public final native void setNodes(JsArray<CytoscapeWebNetworkModelNode> nodes) /*-{
		if (!this.data)
			this.data = {};
		this.data.nodes = nodes;
	}-*/;

	public final native void setEdges(JsArray<CytoscapeWebNetworkModelEdge> edges) /*-{
		if (!this.data)
			this.data = {};
		this.data.edges = edges;
	}-*/;

	public final native void setNodesDataSchema(JsArray<CytoscapeWebDataField> nodes) /*-{
		if (!this.dataSchema)
			this.dataSchema = {};
		this.dataSchema.nodes = nodes;
	}-*/;

	public final native void setEdgesDataSchema(JsArray<CytoscapeWebDataField> edges) /*-{
		if (!this.dataSchema)
			this.dataSchema = {};
		this.dataSchema.edges = edges;
	}-*/;
}
